using System;
using System.Collections.Generic;
using System.Text;
using Registry = Microsoft.Win32.Registry;

namespace SqlBuddy
{
    class RegistrySetting
    {
        private string setting;
        private string registryPath;
        private string attributeName;
        public RegistrySetting(string registryPath, string attributeName)
        {
            this.registryPath = registryPath;
            this.attributeName = attributeName;
        }
        private object GetValue(string val)
        {
            return Registry.GetValue(registryPath, val, null);
        }
        private void SetValue(string regValue, object val)
        {
            Registry.SetValue(registryPath, regValue, val);
        }
        public string Value
        {
            get { return (setting); }
            set { setting = value; }
        }
        public void Load()
        {
            setting = (string)GetValue(attributeName);
        }
        public void Save()
        {
            SetValue(attributeName, setting);
        }
    }
}
